<template>
  <div class="left">
    <h1>Left组件</h1>
    <h1>{{$store.state.num}}</h1>
    <button @click="clickIncrement">+1</button>
  </div>
</template>

<script>
export default {
    methods:{
        clickIncrement(){
            this.$store.commit('increment')
        }
    },
    mounted(){
        //调用vuex中的actions中的loadNum方法
        this.$store.dispatch('loadNum')
    }
}
</script>

<style>
    .left{
        width: 100%;
        height: 200px;
        background-color:orange;
    }
</style>